# class God:
#     #
#     # def __init__(self,name):
#     #     self.name = name
#
#     def fly(self):
#         print('会飞')
#
#     def climb(self):
#         print('神仙累了也需要爬树')
#
# class Monkey:
#
#     # def __init__(self,sex):
#     #     self.sex = sex
#
#     def climb(self):
#         print('爬树')
#
#
# class MonkeySun(God, Monkey):
#     pass
# # 多继承的难点就是继承顺序的问题
#
# sun = MonkeySun()
# sun.climb()

# python2x
# class A:  # 经典类
#     pass
#
# class B(object):  # 新式类
#     pass


# python3x:(默认继承object)
# class C: # 新式类
#     pass


class A:
    pass

class B(A):
    pass

class C(A):
    pass

class D(B, C):
    pass

class E:
    pass

class F(D, E):
    pass

class G(F, D):
    pass

class H:
    pass

class Foo(H, G):
    pass
# print(Foo.mro())
# mro算法  面试中有可能会遇到

# mro(Child(Base1，Base2)) = [ Child ] + merge( mro(Base1), mro(Base2), [ Base1, Base2] )
# mro(Foo(H,G)) = [Foo] + merge(mro(H), mro(G),[H,G])

# 表头：
# 　　列表的第一个元素
#
# 表尾：
# 　　列表中表头以外的元素集合（可以为空）
# 表头,表尾
# [A,B,C] : 表头: A 表尾: [B,C]
# [A] : 表头: A 表尾: []

'''
class O:
    pass

class D(O):
    pass

class E(O):
    pass

class F(O):
    pass

class B(D,E):
    pass

class C(E,F):
    pass

class A(B,C):
    pass

# a = A()
# a.func()
'''
'''
mro(A) = mro(A(B,C))
       = [A] + merge(mro(B), mro(C), [B,C])

mro(B) = mro(B(D,E))
       = [B] + merge(mro(D), mro(E), [D,E])
       = [B] + merge([D,O], [E,O], [D,E])
       = [B,D] + merge([O], [E,O], [E])
       = [B,D,E,O]
       
mro(C) = mro(C(E,F))
       = [C] + merge(mro(E), mro(F),[E,F])
       = [C] + merge([E,O],[F,O],[E,F])
       = [C,E] + merge([O],[F,O],[F])
       = [C,E,F,O]

mro(A) = mro(A(B,C))
       = [A] + merge([B,D,E,O], [C,E,F,O], [B,C])
       = [A,B] + merge([D,E,O], [C,E,F,O], [C])
       = [A,B,D] + merge([E,O], [C,E,F,O], [C])
       = [A,B,D,C] + merge([E,O], [E,F,O])
       = [A,B,D,C,E] + merge([O], [F,O])
       = [A,B,D,C,E,F,O]

       
      
       

'''
class O:
    pass

class D(O):
    pass

class E(O):
    pass

class F(O):
    pass

class B(D,E):
    pass

class C(E,F):
    pass

class A(B,C):
    pass

# 工作中用mro()方法研究新式类的继承顺序
print(A.mro())



